package com.buaa.divinationmaster.database.dao;

import androidx.room.Dao;
import androidx.room.Insert;
import androidx.room.Query;

import com.buaa.divinationmaster.database.entity.TarotCardEntity;

import java.util.List;

/**
 * 塔罗牌数据访问对象
 */
@Dao
public interface TarotCardDao {
    
    @Insert
    void insert(TarotCardEntity card);
    
    @Insert
    void insertAll(List<TarotCardEntity> cards);
    
    @Query("SELECT * FROM tarot_cards ORDER BY id")
    List<TarotCardEntity> getAllCards();
    
    @Query("SELECT * FROM tarot_cards WHERE id = :id")
    TarotCardEntity getCardById(int id);
    
    @Query("SELECT * FROM tarot_cards WHERE type = :type ORDER BY id")
    List<TarotCardEntity> getCardsByType(String type);
    
    @Query("SELECT * FROM tarot_cards WHERE suit = :suit ORDER BY number")
    List<TarotCardEntity> getCardsBySuit(String suit);
    
    @Query("SELECT COUNT(*) FROM tarot_cards")
    int getCardCount();
    
    @Query("DELETE FROM tarot_cards")
    void deleteAllCards();
}
